macro(mapnik_print_version)
    string(TOUPPER ${ARGV0} TLNUP)
    set(TLN ${ARGV0})
    if(${TLN}_VERSION_STRING)
        message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION_STRING}")
    elseif(${TLN}_VERSION)
        message(STATUS "Using ${ARGV0} version: ${${TLN}_VERSION}")
    elseif(${TLNUP}_VERSION_STRING)
        message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION_STRING}")
    elseif(${TLNUP}_VERSION)
        message(STATUS "Using ${ARGV0} version: ${${TLNUP}_VERSION}")
    else()
        message(STATUS "Using ${ARGV0}")
    endif()
endmacro()

macro(mapnik_find_package)
    find_package(${ARGN})
    if(${ARGV0}_FOUND)
        set(MAPNIK_TMP_DEP ${ARGN})
        list(JOIN MAPNIK_TMP_DEP " " MAPNIK_TMP_DEP)
        list(APPEND MAPNIK_DEPENDENCIES "find_dependency(${MAPNIK_TMP_DEP})")
        mapnik_print_version(${ARGV0})
    else()
        message(STATUS "not found: ${ARGV0}")
    endif()
endmacro()

macro(mapnik_find_threads)
    find_package(Threads REQUIRED)
    if(CMAKE_THREAD_LIBS_INIT)
        message(STATUS "Using Threads (system libraries)")
    elseif(CMAKE_USE_WIN32_THREADS_INIT)
        message(STATUS "Using Threads (win32 threads)")
    elseif(CMAKE_USE_PTHREADS_INIT)
        message(STATUS "Using Threads (pthread)")
    elseif(CMAKE_HP_PTHREADS_INIT)
        message(STATUS "Using Threads (HP thread)")
    else()
        message(STATUS "Using Threads (unknown backend)")
    endif()
endmacro()
